﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RBAC.Domain.SmartHealthcare.Hosiptial
{
    /// <summary>
    /// 病人表
    /// </summary>
    public class PatientListModel : BaseEntity
    {
        // <summary>
        /// 身份证号
        /// </summary>
        public string IdCard { get; set; } = string.Empty;
        /// <summary>
        /// 医疗卡
        /// </summary>
        public string MedicalCard { get; set; }
        /// <summary>
        /// 姓名
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// 患者姓名（与Name同义，为了兼容性添加）
        /// </summary>
        [NotMapped]
        public string PatientName { get { return Name; } set { Name = value; } }
        /// <summary>
        /// 性别 
        /// </summary>
        public string Gender { get; set; }
        /// <summary>
        /// 出生日期
        /// </summary>
        public DateTime BirthDay { get; set; }
        /// <summary>
        /// 年龄
        /// </summary>
        public int Age 
        { 
            get 
            {
                var today = DateTime.Today;
                var age = today.Year - BirthDay.Year;
                if (BirthDay.Date > today.AddYears(-age)) age--;
                return age;
            } 
        }
        /// <summary>
        /// 手机
        /// </summary>
        public string Phone { get; set; }
        /// <summary>
        /// 地址
        /// </summary>
        public string Address { get; set; }


    }
}
